<!--Generate by Kevin's CodeBuilder -->
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>bui-ssm快速开发框架</title>
<head th:include="source::header"></head>
</head>
<body>
	<div id="form_main_wrap" class="form_main_wrap" style="height: 100%">
		<div class="form_condition">
			<div style="padding: 20px 12px;">
				<span>开始时间：</span><input type="text" id="startTime" /> 
				<span style="padding-left: 16px;">结束时间：</span><input type="text" 	id="endTime" /> 
				<span><button id="queryBtn" class="common_button"><i class="fa fa-search"> </i>[(${Lang.common_btn_query})]</button> </span>
			</div>
		</div>
		<div class="form_grid" style="height: 100%">
			<table id="datagrid"></table>
		</div>
	</div>
	</div>
	<script type="application/javascript" th:inline="javascript">
		
		var curdObj,
			$win,
			height = 420,
			gridOpts = [(${dataGridJson})];//获取datagrid配置json
			var title = "[(${Lang.log_windowTitle})]";//国际化语言
			gridOpts.title = title;
		$(function () {
			
			FitForm($("#form_main_wrap"));//datagrid满屏适配
			
			var now = new Date();
			now.setDate(now.getDate() - 12);
			var $sTime = $("#startTime");
			new $B.Calendar($sTime,{
                isSingel: true,
                clickHide:true,
                fmt:'yyyy-MM-dd hh:mm:ss',
                fitWidth:true,
                initValue: now.format("yyyy-MM-dd hh:mm:ss"),                
                range:{ max:'#endTime'  }
            }); 
			
			var $eTime = $("#endTime");
			now.setDate(now.getDate() + 12);
			new $B.Calendar($eTime,{
                isSingel: true,
                clickHide:true,
                fmt:'yyyy-MM-dd hh:mm:ss',
                fitWidth:true,
                initValue: now.format("yyyy-MM-dd hh:mm:ss"),                
                range:{ min:'#startTime'  }
            }); 
			
			
			var dg = $("#datagrid");
			gridOpts.sortField={
		        'createTime': 'desc'
		    }; //默认排序字段
		    gridOpts.fillParent = true;//沾满父元素空间
			curdObj = new $B.CURD(dg, gridOpts);
		    
		    $("#queryBtn").click(function(){
		    	
		    	curdObj.reload({
		    		minTime : $sTime.val(),
		    		maxTime	: $eTime.val()
		    	});
		    });
		});
		//打开form.html
		function _openForm(prs,isUpdate,rowData){
			var opts = {
				dataType:'html',
				title:title,
				width:700,
				height:height
			};
			if(isUpdate && rowData){
				opts.rowData = rowData;
			}
			curdObj.window(opts,isUpdate);
		};
		/******工具栏事件集合******/
		window.toolMethods = {
			addFn:function(prs){
				_openForm(prs);
			},
			updateFn:function(prs){
				_openForm(prs,true);
			},
			deleteFn:function(prs){
				curdObj.delChecked();
			},
			exportFn:function(prs){
				$win = $B.window({
					title:'[(${Lang.common_xlsExport})]',
					dataType:'iframe',
					width:400,
					height:200,
					content: $B.getHttpHost(ctxPath) + "log/page/exportXls"
				});
			}
		};
		
		function getParams(){
			return {};
		}
		function formatstatus(cData,rData){
			if(cData === 1){
				return "成功";
			}
			return "失败";
		}

	</script>
</body>
</html>
